package tw.edu.tku.im.maze;

import org.json.JSONException;
import org.json.JSONObject;

public class EndGameReqParser extends PacketParser {
   public static EndGameReqParser INSTANCE = new EndGameReqParser();
   
   private EndGameReqParser() { }
   
   @Override
   public EndGameReq parse(JSONObject jsonObj) throws JSONException {
      JSONObject parameter = jsonObj.getJSONObject("parameter");
      int roomID = parameter.getInt("roomID");
      String userID = parameter.getString("userID");
      int ticket = parameter.getInt("ticket");
      return new EndGameReq(roomID, userID, ticket);
   }

   @Override
   public String acceptName() {
      return "endGame";
   }
}
